use East2West
go
--Get Details Banking by CC_Number and PIN_Code
create proc sp_GetBank
	@CCNumber nvarchar(50),
	@PINCode nvarchar(50)
as
	SELECT * FROM Banking WHERE CreditCardNumber=@CCNumber AND PINCode=@PINCode
GO	
--Deposit
CREATE PROC sp_Deposit
	@CCNumber nvarchar(50),
	@PINCode nvarchar(50),
	@Amount money
AS
	UPDATE Banking SET Balance=Balance+@Amount WHERE CreditCardNumber=@CCNumber AND PINCode=@PINCode
GO
--Withdraw
CREATE PROC sp_Withdraw
	@CCNumber nvarchar(50),
	@PINCode nvarchar(50),
	@Amount money
AS

	UPDATE Banking SET Balance=Balance-@Amount WHERE CreditCardNumber=@CCNumber AND PINCode=@PINCode
	
GO
CREATE PROC sp_GetBankByCusID
	@CustomerID int
AS
	SELECT * FROM Banking WHERE CustomerID=@CustomerID
